
<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
    <!-- Start of Baidu Transcode -->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta name="applicable-device" content="pc,mobile">
    <meta name="MobileOptimized" content="width"/>
    <meta name="HandheldFriendly" content="true"/>
    <meta name="mobile-agent" content="format=html5;">
    <!-- End of Baidu Transcode -->

    <meta name="description"  content="欢迎来到西安交大深圳MEM2018年会现场！">

    <!-- Apple -->
    <meta name="apple-mobile-web-app-title" content="西安交大深圳MEM2018年会">
    <title>西安交大深圳MEM2018年会</title>
    <link rel="stylesheet" media="all" href="index.css" />

    <link rel="stylesheet" media="all" href="style.css" />

    <script src="jquery-1.8.0.js"></script>

    <style type="text/css">

    </style>

</head>

<body class="no-padding reader-black-font" lang="zh-CN">
<div class="sign">
    <div class="main">
        <h4 class="title">
            <div class="normal-title">
                <a id="js-sign-btn" class="active" href="sign.html">签到</a>
                <b>·</b>
                <a id="js-speak-btn" class="" href="speak.html">发言</a>
                <b>·</b>
                <a id="js-contribute-btn" class="" href="contribute.html">赞助</a>
            </div>
        </h4>
        <div class="js-sign-up-container">
            <form class="new_user" id="new_user" action="/api/sign" onsubmit="return validate(this);" accept-charset="UTF-8" method="post">
                <!-- <input name="utf8" type="hidden" value="&#x2713;" /> -->
                <!-- <input type="hidden" name="authenticity_token" value="VdBm6HKC85Tm6WyZ2p3wO2iZKUVN17mUjabvSYVIyl99g16PguJ0bc3TojmbwwyqVcjJGF3CdXS4GQBnu0BLPw==" /> -->
                <div class="input-prepend restyle">
                    <input placeholder="你的姓名" type="text" value="" name="name" id="user_username" />
                     <!--<i class="iconfont ic-user">用户名</i>-->
                    <!-- <span class="iconfont ic-user">用户名</span> -->
                </div>

                <div class="input-prepend restyle no-radius js-normal">
                     <!--<input type="hidden" value="CN" name="user[mobile_number_country_code]" id="user_mobile_number_country_code" />-->
                    <input placeholder="手机号" type="tel" name="mobile" id="user_mobile_number" />
                    <!--<i class="iconfont ic-phonenumber"></i>-->
                </div>
                <!-- <input type="hidden" name="oversea" id="oversea" value="false" />
                <input type="hidden" name="force_user_nonexist" id="force_user_nonexist" value="true" /> -->
                <div class="input-prepend restyle no-radius js-security-number">
                    <input type="text" name="smsCode" id="sms_code" placeholder="手机验证码" />
                    <!--<i class="iconfont ic-verify"></i>-->
                    <button tabindex="-1" class="btn-up-resend js-send-code-button" id="smsBtn">发送验证码</button>
                    <!-- <div class="js-geetest-captcha"></div> -->
                </div>
                <!--
                <input type="hidden" name="security_number" id="security_number" /> -->
                <div class="input-prepend">
                    <input placeholder="班级" type="text" name="className" id="user_class" />
                    <!-- <i class="iconfont ic-password"></i> -->
                </div>

                <!--
                <input type="hidden" name="security_number" id="security_number" /> -->
                <div class="input-prepend">
                    <input placeholder="留言" type="text" name="message" id="user_message" />
                    <!-- <i class="iconfont ic-password"></i> -->
                </div>
                <input type="submit" value="提交" class="sign-up-button" id="submitBtn" data-disable-with="提交" />
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">

    window.onload = function(){
        var smsBtn = document.getElementById("smsBtn");

        smsBtn.onclick = function() {

            var telphone = document.getElementById("user_mobile_number").value;
            if (telphone.length != 11){
                alert("请正确输入手机号!")
                return
            }
            settime(smsBtn,60)
            var object = {"mobile": telphone};

            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open("POST", "http://www.thoughtmocks.com/api/smscode", false);
            xmlHttp.send(JSON.stringify(object));

            alert(xmlHttp.responseText);
        }
    }
    function settime(val,countdown) {
        if (countdown == 0) {
            val.removeAttribute("disabled");
            val.innerText="重新获取验证码";
            return;
        } else {
            val.setAttribute("disabled", true);
            val.innerText="重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function() {
            settime(val,countdown);
        },1000);
    }

    function validate(form){

        with (form) {
            alert(form.username.value);
            alert(form.mobile.value);
            alert(form.smsCode.value);
            alert(form.className.value);
            alert(form.message.value);
            return false;
        }
        return true;
    }
</script>

</body>
</html>